<?php
include('./SourceCode/Session.php');
include('./SourceCode/mysqli_connect.php');
include('./SourceCode/functions.php');

if(isset($_SESSION['uid'])){
    $query = "UPDATE `user` SET `user_online` = 0 WHERE `user_id`='{$_SESSION['uid']}'";
    $result = mysqli_query($dbc, $query);
    $_SESSION[] = array();
    session_destroy();
    setcookie(session_name(),'',time()-360000);
    Redirect();
}else{
    Redirect();
}